@mixin default-focus-style {
  border-color: $blue;
  box-shadow: 0 0 1px 1px $blue;
  outline: none;

  &::-moz-focus-inner {
    border: none !important;
    padding: 1px !important;
  }
}

@mixin button-defaults(
  $first-color: $button-gradient-first-color,
  $second-color: $button-gradient-second-color,
  $border-radius: $default-border-radius,
  $padding: $button-padding,
  $margin: $button-margin) {
  display: inline-block;
  font-size: 12px;
  padding: $padding;
  cursor: pointer;
  border-radius: $border-radius;
  background-color: $button-bg-color;
  background-image: linear-gradient($first-color, $second-color);
  box-shadow: white 0 1px 0 inset;
  border: 1px solid $button-border-color;
  color: $text-color;
  text-shadow: $button-text-shadow;
  margin: $margin;
  @include appearance(none);

  &:hover {
    text-decoration: none;
    background-color: $button-hover-bg-color;
    background-image: linear-gradient(
      darken($first-color, 5%),
      darken($second-color, 5%)
    );
    border-color: $button-hover-border-color;
  }

  &:active, &:active:focus {
    box-shadow: #c4c4c4 0 1px 2px inset;
    border-color: $button-border-color;
  }

  &:focus {
    @include default-focus-style;
  }

  &.disabled, &[disabled],
  &.disabled:active, &[disabled]:active,
  &.disabled:hover, &[disabled]:hover {
    opacity: 0.6;
    background: $second-color;
    cursor: not-allowed;
    box-shadow: none;
  }

  &::-moz-focus-inner {
    padding: 0 !important;
    margin: -1px !important;
  }
}

@mixin default-label-style {
  font-size: 10px;
  text-shadow: #fff 0 1px 2px;
  margin-top: $default-margin;
  display: block;
  line-height: 100%;
  @extend .disable-user-select;
  clear: both;
}

@mixin form-label {
  @extend .border-box-sizing;
  width: $form-left-width;
  padding-right: 2*$default-padding;
  padding-top: $default-padding + 1;
  margin-top: 4px;
  vertical-align: top;
  line-height: 19px;
  word-break: normal;
  float: left;
  text-align: right;
}

@mixin form-heading {
  border-bottom: 1px solid #CECECE;
  padding-right: 8px;
  margin-top: 8px;
  text-align: right;
  font-weight: normal;
  color: #585858;
  text-transform: uppercase;
}

@mixin form-value-display {
  float: right;
  width: $form-right-width;
  margin: $default-form-field-margin;
  padding: $default-padding 2*$default-padding;
  line-height: 21px;
  min-height: $default-form-field-height;
  background: white;
  @extend %rounded-border;
  @extend .border-box-sizing;
}

@mixin form-hint($background-color: $light_yellow, $border-color: $medium-gray) {
  font-size: 10px;
  line-height: 1.5em;
  padding: $default-padding;
  background-color: $background-color;
  border: 1px solid $border-color;
  display: block;
  clear: both;
  @extend %rounded-border;
}

@mixin animate-left {
  -webkit-transition: left 0.15s ease-in-out;
  -moz-transition: left 0.15s ease-in-out;
  -ms-transition: left 0.15s ease-in-out;
  -o-transition: left 0.15s ease-in-out;
  transition: left 0.15s ease-in-out;
}

@mixin bottom-right-rounded-border {
  $side: bottom-right;
  $radius: 3px;
  -webkit-border-#{$side}-radius: $radius;
  -moz-border-radius-#{$side}: $radius;
  -ms-border-#{$side}-radius: $radius;
  -o-border-#{$side}-radius: $radius;
  border-#{$side}-radius: $radius;
}

@mixin drop-shadow {
  $shadow: 0px 0px 4px $dark-gray;
  -webkit-box-shadow: $shadow;
  -moz-box-shadow: $shadow;
  -ms-box-shadow: $shadow;
  -o-box-shadow: $shadow;
  box-shadow: $shadow;
}

@mixin box-sizing($box-sizing-type: content-box) {
  -webkit-box-sizing: $box-sizing-type;
  -moz-box-sizing: $box-sizing-type;
  box-sizing: $box-sizing-type;
}

@mixin tag-base($margin: 2*$default-margin 0, $padding: $default-padding 4*$default-padding $default-padding 6*$default-padding) {
  padding: $padding;
  margin: $margin;
  background-color: $medium-gray;
  overflow: hidden;
  position: relative;
  @extend %rounded-border;

  &:before {
    position: absolute;
    left: 8px;
    top: 8px;
    font-family: 'Alchemy Icons';
    @extend .icon-tag:before;
    line-height: 8px;
  }
}

@mixin linked-button($border-radius: $default-border-radius) {
  @include button-defaults(
    $first-color: $linked-color,
    $second-color: darken($linked-color, 10%),
    $border-radius: $border-radius,
    $padding: 3px,
    $margin: 0
  );
}

@mixin zoom-in {
  cursor: pointer;
  cursor: image-url('alchemy/lupe.cur');
  cursor: -webkit-zoom-in;
  cursor: -moz-zoom-in;
  cursor: zoom-in;
}

@mixin truncate($max-width, $display: inline-block) {
  display: $display;
  max-width: $max-width;
  overflow: hidden;
  text-overflow: ellipsis;
}
